package com.ruibang.glass.iso.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.ruibang.glass.iso.domain.req.PermissionManageReq;
import com.ruibang.glass.iso.domain.req.PermissionReq;
import com.ruibang.glass.iso.entity.PermissionManage;
import com.ruibang.glass.iso.service.impl.PermissionManageService;
import com.teaming.cloud.framework2.common.model.ResultBody;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

/**
 * @Author: songJinKang
 * @CreateTime: 2024-06-18  09:38
 * @Description: TODO
 * @Version: 1.0
 */

@RestController
@RequestMapping("/api/iso/permissionManage")
@Api(value = "权限管理控制器", tags = {"权限管理控制器"})
public class PermissionManageController {

    @Autowired
    private PermissionManageService permissionManageService;

    @PostMapping("/pageQuery")
    @ApiOperation(value = "分页查询文件类别信息", response = ResultBody.class)
    public ResultBody<IPage<PermissionManage>> pageQuery(@RequestBody PermissionManageReq permissionManageReq) {
        return ResultBody.success(permissionManageService.pageQuery(permissionManageReq));
    }

    @PostMapping("/getByObjId")
    @ApiOperation(value = "根据对象ID获取权限信息", response = ResultBody.class)
    public ResultBody<List<PermissionManage>> getByObjId(@RequestBody @Valid PermissionReq permissionReq) {
        return ResultBody.success(permissionManageService.getByObjId(permissionReq));
    }
}
